package org.yfl.mbg.enhance.utils;

/**
 * 数据库驱动工具类
 * @author yanfeilin
 * @version 1.0.0
 * @date 2020/5/20 23:29
 */
public class DbDriverUtil {

    private DbDriverUtil(){

    }

    /**
     * 根据jdbc url推断driver class
     * @param jdbcUrl
     * @return
     */
    public static String deduceDriverClass(String jdbcUrl){
        if(jdbcUrl.contains("mysql")){
            return "com.mysql.jdbc.Driver";
        }else if(jdbcUrl.contains("sqlserver")){
            return "com.microsoft.sqlserver.jdbc.SQLServerDriver";
        }else if(jdbcUrl.contains("oracle")){
            return "oracle.jdbc.driver.OracleDriver";
        }
        return "com.mysql.jdbc.Driver";
    }
}
